import java.io.*;
import java.awt.*;
import java.lang.*;

public class extends2  
{
   
   public static void main(String[] args) throws IOException 
   {
    
       
       Son joe = new Son();
       joe.bumpsize();   // call to the parent method
       System.out.println(" joe Son size is "+joe.size);
       joe.jumpsize(); // call to the son method
       //Son roger = new Son(5); constructors are not inherited
       Parent bill = new Parent(15);
       System.out.println(" Parent bill size is "+bill.size);
       bill.bumpsize();
       //bill.jumpsize(); error parent cannot inherit child methods
       
    
    } //end main

} //end class

class Parent 
    {
     //private int size; compile error because "private" cannot be inherited
       protected int size;

       Parent() { //constructor
       size = 7;}
       
       Parent(int size) { // overloaded constructor
       this.size = size;}
     
     void bumpsize()  //Parent method which is public by default
     {
      size++;
      System.out.println();
      System.out.println("Parent size is " + size);
     }
    }//end Parent
     
     class Son extends Parent   //Son is a subclass of Parent
      {
              
      void jumpsize()  //Son method which is public to the package by default
     {
      size = ++size +1;
      System.out.println("Son size is now " + size);
     }
      }// end Son

/* public - access by any class or method
   protected -  only sub-classes can access these attributes; can be inherited
   private - only public methods can access the attributes; cannot be inherited */
   